package com.googlecode.moneyManager.model;

import org.hibernate.annotations.IndexColumn;
import org.hibernate.search.annotations.*;

import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Embedded;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.PrimaryKeyJoinColumn;

/**
 * 
 * @author Sergiy Doroshenko
 * 
 */
@Entity
@Indexed
public class Customer extends BaseEntity{

    private List<Deposit> deposit;

    private Address address;

    @Field(index= Index.TOKENIZED, store= Store.NO)
    private String fName;

    @Field(index= Index.TOKENIZED, store= Store.NO)
    private String sName;

    public Customer() {
    }

    public Customer(String fName, String sName) {
        this.fName = fName;
        this.sName = sName;
    }

    @OneToMany(fetch = FetchType.LAZY, cascade = { CascadeType.ALL }, mappedBy = "customer")
    public List<Deposit> getDeposit() {
	return deposit;
    }

    public void setDeposit(List<Deposit> deposit) {
	this.deposit = deposit;
    }
    @Embedded
    public Address getAddress() {
	return address;
    }

    public void setAddress(Address address) {
	this.address = address;
    }

    public String getFName() {
        return fName;
    }

    public void setFName(String name) {
        fName = name;
    }

    public String getSName() {
        return sName;
    }

    public void setSName(String name) {
        sName = name;
    }

}
